
use T2Logging;
GO
-- Drop stored procedure if it already exists
IF EXISTS (
  SELECT * 
    FROM INFORMATION_SCHEMA.ROUTINES 
   WHERE SPECIFIC_CATALOG = N'T2Logging' 
	 AND SPECIFIC_SCHEMA = N'dbo'
     AND SPECIFIC_NAME = N'Log_GetOne' 
)
   DROP PROCEDURE dbo.Log_GetOne
GO
create procedure dbo.Log_GetOne
@LogID Int = null OUTPUT,
	@RowsAffected int = null OUTPUT 
	
--*************************************************************
--Created By: trooks
--Name: dbo_Log_GetOne
--Table: Log 
--Schema: dbo
--Database: T2Logging
--Created Date: 02/15/2013 00:00:00
--*************************************************************

as
	Begin Try
		Select 
		LogID, 
		Priority, 
		Severity, 
		Title, 
		MachineName, 
		AppDomainName, 
		Message, 
		TS, 
		CreatedBy, 
		CreatedDt, 
		ModifiedBy, 
		ModifiedDt, 
		ApplicationID, 
		LogCategoryID 
		From [dbo].Log
		 where
		 @LogID = LogID

		Set @RowsAffected = @@ROWCOUNT;
		return 0;	
	END TRY
	BEGIN CATCH
		Set @RowsAffected = 0;
		EXEC dbo.uspLogError;
		return -1;
	END CATCH
	
GO
GRANT EXECUTE ON [T2Logging].[dbo].[Log_GetOne] to PORTAL_T2Logging
GO